<?php 
/**
 * @Title: enclosing_method
 * @Description: 
 * @return: return_type
 * @author: yulong.wang
 * @date: 2015-1-15下午7:28:37
*/
use common\models\SysAdminUser;
$this->title = '管理员站点分配';
$this->params ['breadcrumbs'] [] = $this->title;
?>
<style>
.form-group{
	margin: 30px 0 30px 0;
}
.form-group span{
	font-size: 14px;
	border-color: #3c763d;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
	background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
    color: #555;
    font-size: 14px;
    height: 34px;
    line-height: 1.42857;
    padding: 6px 12px;
    transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
}
</style>
<div>
    <h3><?php echo $this->title?></h3>
    <form action="/sys-admin-user/admin-user-site?admin_user_id=<?=f_get('admin_user_id')?>" method="POST">
    <div class="form-group">
    <label class="control-label">管理员：</label>
    <span><?=SysAdminUser::getAdminUserNameById(f_get('admin_user_id'))?></span>
    <input type='hidden' name='admin_user_id' value='<?=f_get('admin_user_id')?>'>
    </div>
    <?php if (!empty($sites)) {?>
    <div class="form-group">
		<label class="control-label">站点：</label>
		<?php
		foreach ($sites as $value) {
		    if ($value['checked'] == 1) {
		 ?>
		      <input type='checkbox' name='site_id[]' value='<?=$value['id']?>' checked='checked'> <?=$value['name']?>&nbsp;&nbsp;
		 <?php      
		    } else {
		?>
		     <input type='checkbox' name='site_id[]' value='<?=$value['id']?>'> <?=$value['name']?>&nbsp;&nbsp;
		<?php } }?>
    </div>
    <?php }?>
    <input type="button" value="全选" class="btn btn-success" style="padding:1px;"  id="choseAll"/>
	<input type="button" value="取消全选" class="btn btn-success" style="padding:1px;"  id="delAll"/>
	
    <div class="form-group">
	   <button type="submit" name='save' class="btn btn-success">提交</button>
	</div>
	</form>
</div>
<script>
//全部选择
	 $("#choseAll").click(function(){
		  $("input[name='site_id[]']").each(function(){
			  this.checked = true;
		  });
	 });
	//取消选择
	 $("#delAll").click(function(){
		  $("input[name='site_id[]']").each(function(){
			  this.checked = false;
		  });
	 });
</script>